﻿using System;
using CoreRay;
using CoreRay.Testing.MockClasses;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace CoreRay.Testing
{
    //-----------------------------------------------------------------------------------------
    /// <summary>
    /// Test class for <see cref="RenderRegionManager"/> abstract class.
    /// </summary>
    //-----------------------------------------------------------------------------------------
    [TestClass]
    public class RenderRegionManagerTest
    {
        //-----------------------------------------------------------------------------------------
        /// <summary>
        /// A test for <see cref="RenderRegionManager"/> constructor.
        /// </summary>
        //-----------------------------------------------------------------------------------------
        [TestMethod]
        public void RenderRegionManagerConstructorTest()
        {
            int regionWidth = 64;
            int regionHeight = 32;
            int totalWidth = 586;
            int totalHeight = 325;

            RenderRegionManager target = new MockRenderRegionManager(regionWidth, regionHeight, totalWidth, totalHeight);

            Assert.IsTrue(target.RegionWidth == regionWidth && target.RegionHeight == regionHeight && target.TotalWidth == totalWidth && target.TotalHeight == totalHeight);
        }


        //-----------------------------------------------------------------------------------------
        /// <summary>
        /// A test for <see cref="RenderRegionManager"/> constructor with negative regionWidth.
        /// </summary>
        //-----------------------------------------------------------------------------------------
        [TestMethod]
        [ExpectedException(typeof(ArgumentException))]
        public void RenderRegionManagerConstructorNegativeRegionWidthTest()
        {
            int regionWidth = -64;
            int regionHeight = 32;
            int totalWidth = 586;
            int totalHeight = 325;

            RenderRegionManager target = new MockRenderRegionManager(regionWidth, regionHeight, totalWidth, totalHeight);
        }


        //-----------------------------------------------------------------------------------------
        /// <summary>
        /// A test for <see cref="RenderRegionManager"/> constructor with negative regionHeight.
        /// </summary>
        //-----------------------------------------------------------------------------------------
        [TestMethod]
        [ExpectedException(typeof(ArgumentException))]
        public void RenderRegionManagerConstructorNegativeRegionHeightTest()
        {
            int regionWidth = 64;
            int regionHeight = -32;
            int totalWidth = 586;
            int totalHeight = 325;

            RenderRegionManager target = new MockRenderRegionManager(regionWidth, regionHeight, totalWidth, totalHeight);
        }


        //-----------------------------------------------------------------------------------------
        /// <summary>
        /// A test for <see cref="RenderRegionManager"/> constructor with negative totalWidth.
        /// </summary>
        //-----------------------------------------------------------------------------------------
        [TestMethod]
        [ExpectedException(typeof(ArgumentException))]
        public void RenderRegionManagerConstructorNegativeTotalWidthTest()
        {
            int regionWidth = 64;
            int regionHeight = 32;
            int totalWidth = -586;
            int totalHeight = 325;

            RenderRegionManager target = new MockRenderRegionManager(regionWidth, regionHeight, totalWidth, totalHeight);
        }


        //-----------------------------------------------------------------------------------------
        /// <summary>
        /// A test for <see cref="RenderRegionManager"/> constructor with negative totalHeight.
        /// </summary>
        //-----------------------------------------------------------------------------------------
        [TestMethod]
        [ExpectedException(typeof(ArgumentException))]
        public void RenderRegionManagerConstructorNegativeTotalHeightTest()
        {
            int regionWidth = 64;
            int regionHeight = 32;
            int totalWidth = 586;
            int totalHeight = -325;

            RenderRegionManager target = new MockRenderRegionManager(regionWidth, regionHeight, totalWidth, totalHeight);
        }


        //-----------------------------------------------------------------------------------------
        /// <summary>
        /// A test for <see cref="RenderRegionManager"/> constructor with total width smaller
        /// than regionWidth.
        /// </summary>
        //-----------------------------------------------------------------------------------------
        [TestMethod]
        [ExpectedException(typeof(ArgumentException))]
        public void RenderRegionManagerConstructorTotalWidthSmallerTest()
        {
            int regionWidth = 64;
            int regionHeight = 32;
            int totalWidth = 35;
            int totalHeight = 325;

            RenderRegionManager target = new MockRenderRegionManager(regionWidth, regionHeight, totalWidth, totalHeight);
        }


        //-----------------------------------------------------------------------------------------
        /// <summary>
        /// A test for <see cref="RenderRegionManager"/> constructor with total height smaller
        /// than regionHeight.
        /// </summary>
        //-----------------------------------------------------------------------------------------
        [TestMethod]
        [ExpectedException(typeof(ArgumentException))]
        public void RenderRegionManagerConstructorTotalHeightSmallerTest()
        {
            int regionWidth = 64;
            int regionHeight = 32;
            int totalWidth = 150;
            int totalHeight = 24;

            RenderRegionManager target = new MockRenderRegionManager(regionWidth, regionHeight, totalWidth, totalHeight);
        }
    }
}
